﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FireLinkEntry.aspx.cs"
    Inherits="MTRC.ODMS.Web.SOM.CodeSetup.FireLinkEntry" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<%@ Register Src="~/UserControl/Menu/PageFoot.ascx" TagName="PageFoot" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/TabStrip.ascx" TagName="TabStrip" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/PageHead.ascx" TagName="PageHead" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="WebStructure" %>
<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>SOM</title>
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" />
    <link href="../../CSS/common.css" rel="stylesheet" type="text/css" />
    <script src="../../Javascript/CommonFunction.js" type="text/javascript"></script>
    <script type="text/javascript">
        var LeavePage = '<%=this.GetMessage("COM_LeavePage")%>'
        function IsInteger(val) {
            var re;
            re = /^[0-9]*[1-9][0-9]*$/;
            return re.exec(val);
        }

        function CheckInt(obj) {
            if (obj.value != "") {
                if (!IsInteger(obj.value)) {
                    obj.value = obj.title;
                    return false;
                }
                else
                    return true;
            }
            else
                return true;
        }

        function Cancel() {

            if (IsServerChanged || IsPageChanged()) {
                if (confirm(LeavePage)) {
                    window.location.href = "FireLinkList.aspx";
                }
            }
            else {
                window.location.href = "FireLinkList.aspx";
            }
            return false;
        }

        function New() {

            if (IsServerChanged || IsPageChanged()) {
                if (confirm(LeavePage)) {
                    window.location.href = "FireLinkEntry.aspx?action=new";
                }
            }
            else {
                window.location.href = "FireLinkEntry.aspx?action=new";
            }
            return false;
        }

        //add by gordon  20151112 U273 Use client event
        function OnDetailLocationAndFireLinkCodeTextChanged() {
            //keycode:8 backspace,46 delete,37-40 L-U-R-D
            var code = document.getElementById("txtCode").value;
            var detailLocation = document.getElementById("txtDetailLocation").value;
            var v = trim(detailLocation + " " + code);
            if (v.length > 25 && (event.keyCode != 8 && event.keyCode != 46 && event.keyCode != 37 && event.keyCode != 38 && event.keyCode != 39 && event.keyCode != 40)) {
                alert('<%=GetMessage("SOM_FireLinkCodeLength") %>');
            } else {
                if (v.length <= 25)
                    document.getElementById("txtFireLinkCode").value = v;
            }
        }
     
    </script>
    <link href="~/CSS/Menu.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
    </AjaxControlToolkit:ToolkitScriptManager>
    <table border="0" cellpadding="0" cellspacing="0" class="Page_Container">
        <tr>
            <td colspan="2" class="Page_Head">
                <WebStructure:PageHead ID="PageHead" runat="server" />
            </td>
        </tr>
        <tr>
            <td class="Page_Left">
                <WebStructure:MainMenu ID="MainMenu" runat="server" AppPath="../../" CurrMenuID="M140911" />
            </td>
            <td class="Page_Right">
                <table class="Page_Contents">
                    <tr>
                        <td class="TabStrip">
                            <WebStructure:TabStrip ID="TabStrip" CurrMenuID="M140811" ParentMenuID="M140911"
                                DMenuMode="CurrOnly" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td class="Contents">
                            <fieldset style="clear: both; margin-bottom: 10px;">
                                <legend class="title1">
                                    <asp:Label ID="lblMenuCaption" runat="server" Font-Bold="True" Font-Size="Small"
                                        CssClass="CodeSetupCaptionText">Label</asp:Label></legend>
                                <table style="padding-left: 8px" valign="top" border="0px" width="100%">
                                    <tr>
                                        <td>
                                            <table id="tblMain" cellspacing="1" cellpadding="1" width="550px" border="0">
                                                <tr>
                                                    <td valign="middle">
                                                    </td>
                                                    <td valign="middle">
                                                    </td>
                                                    <td valign="middle">
                                                        <em></em>
                                                    </td>
                                                    <td valign="middle">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="middle">
                                                        <asp:Label ID="lblStation" runat="server">Station:</asp:Label><em>*</em>
                                                    </td>

                                                    <td colspan="3" valign="middle">
                                                        <asp:DropDownList ID="ddlStation" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlStation_SelectedIndexChanged" Width="390px"></asp:DropDownList>
                                                    </td>
                                                </tr>
                                                <tr>
                                                     <td valign="middle">
                                                        <asp:Label ID="lblCode" runat="server">Code:</asp:Label><em>*</em>
                                                    </td>
                                                    <td valign="middle" colspan="3" >
                                                       <%-- 
                                                       update by gordon  20151112 U273 Use client event
                                                       <asp:TextBox runat="server" MaxLength="10" ID="txtCode" OnTextChanged="txtCode_TextChanged" Width="383px" 
                                                            AutoPostBack="True"></asp:TextBox>--%>
                                                            <asp:TextBox runat="server" MaxLength="10" ID="txtCode" Width="383px" onkeyup="OnDetailLocationAndFireLinkCodeTextChanged();"></asp:TextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="middle">
                                                        <asp:Label ID="lblLocation" runat="server">Location:</asp:Label>
                                                    </td>
                                                    <td valign="middle" colspan="3">
                                                        <asp:DropDownList ID="ddlLocation" runat="server" OnSelectedIndexChanged="ddlLocation_SelectedIndexChanged"
                                                            AutoPostBack="True" Width="390px">
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="top">
                                                        <asp:Label ID="lblDetailLocation" runat="server">Detail Location</asp:Label><em>*</em>
                                                    </td>
                                                    <td align="left" colspan="3">
                                                        <%--
                                                        update by gordon  20151112 U273 Use client event
                                                        <asp:TextBox runat="server" MaxLength="100" ID="txtDetailLocation" Width="383px" AutoPostBack="true" OnTextChanged="txtDetailLocation_TextChangeds"></asp:TextBox>--%>
                                                        <asp:TextBox runat="server" MaxLength="100" ID="txtDetailLocation" Width="383px" onkeyup="OnDetailLocationAndFireLinkCodeTextChanged();" ></asp:TextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="middle">
                                                        <asp:Label ID="lblFireLinkCode" runat="server">Fire Link Code:</asp:Label><em>*</em>
                                                    </td>
                                                    <td valign="middle" colspan="3">
                                                        <asp:TextBox runat="server" MaxLength="25" ID="txtFireLinkCode" Enabled="true" Width="383px"></asp:TextBox>
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td valign="top">
                                                        <asp:Label ID="lblSequenceNo" runat="server">Sequence No.:</asp:Label><em>*</em>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox runat="server" MaxLength="4" ID="txtSequenceNO" onBlur="CheckInt(this)"></asp:TextBox>
                                                    </td>
                                                    <td valign="top">
                                                        <asp:Label ID="lblLine" runat="server">Line:</asp:Label><em>*</em>
                                                    </td>
                                                    <td>
                                                        <asp:DropDownList ID="ddlLine" runat="server" OnSelectedIndexChanged="ddlLine_SelectedIndexChanged"
                                                            AutoPostBack="True" Width="122">
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="middle">
                                                        <asp:Label ID="lblFrom" runat="server">Effective From:</asp:Label><em>*</em>
                                                    </td>
                                                    <td valign="middle">
                                                        <APJ:DateTextBox ID="dtbEffectiveFrom" runat="server" />
                                                    </td>
                                                    <td valign="middle">
                                                        <asp:Label ID="lblTo" runat="server">Effective To:</asp:Label><em>*</em>
                                                    </td>
                                                    <td valign="middle">
                                                        <APJ:DateTextBox ID="dtbEffectiveTo" runat="server" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="4">
                                                        <asp:Label ID="lblObsolete" runat="server">Obsolete:</asp:Label><asp:CheckBox ID="chkObsolete"
                                                            runat="server" AutoPostBack="True" OnCheckedChanged="chkObsolete_CheckedChanged" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="4">
                                                        <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
                                                        <asp:Button ID="btnSaveAndReturn" runat="server" Text="Save And Return" OnClick="btnSaveAndReturn_Click" />
                                                        <asp:Button ID="btnSaveAndNew" runat="server" Text="Save And New" OnClick="btnSaveAndNew_Click" />
                                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="return Cancel()" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>
                        </td>
                    </tr>
                    <tr>
                        <div style="display: none">
                            <input type="hidden" id="hdnStationID" name="hdnStationID" runat="server"><input
                                type="hidden" id="hdnFireLinkID" name="hdnFireLinkID" runat="server" value="0"></div>
                        <td class="Page_Foot" style="height: 54px">
                            <WebStructure:PageFoot ID="PageFoot" runat="server" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
